﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CBMS.Interfaces;
using CBMS.Models;
using System.Data.Objects.DataClasses;
using System.Data.Objects;
using System.Collections;
using CBMS.Objects;
using System.Data.Objects.SqlClient;
using CBMS.Common;
using System.Data.Common;
using System.Data.EntityClient;
using System.Data;
using System.Globalization;

namespace CBMS.Business
{
    public class StateRepository : BaseEntityRepository<State>, IStateRepository
    {
        public StateRepository()
            : base()
        {

        }
        public IList<State> GetAllByCountry(string countryCode)
        {
            IList<State> lstResult = new List<State>();
            try
            {
                var query = (from n in DbContext.States
                           where n.country_code==countryCode && n.is_active==true
                           select n
                           );
                lstResult = query.ToList<State>();                
                return lstResult;
            }
            catch
            {
                return new List<State>(); 
            }
        }
    }
}